/*      */ package com.lmpop.trade.openFlashChart;
/*      */ 
/*      */ import java.io.UnsupportedEncodingException;
/*      */ import java.net.URLEncoder;
/*      */ import java.util.ArrayList;
/*      */ import java.util.List;
/*      */ 
/*      */ public class Graph
/*      */ {
/*    9 */   List<Data_set> data_sets = new ArrayList();
/*      */ 
/*   11 */   List<String> data = new ArrayList();
/*   12 */   List<String> links = new ArrayList();
/*   13 */   int width = 250;
/*   14 */   int height = 200;
/*   15 */   String base = "js/";
/*   16 */   List<String> x_labels = new ArrayList();
/*   17 */   String y_min = "";
/*   18 */   String y_max = "";
/*   19 */   String x_min = "";
/*   20 */   String x_max = "";
/*   21 */   String y_steps = "";
/*   22 */   String title = "";
/*   23 */   String title_style = "";
/*   24 */   int occurence = 0;
/*      */ 
/*   26 */   String x_offset = "";
/*      */ 
/*   28 */   int x_tick_size = -1;
/*      */ 
/*   30 */   String y2_max = "";
/*   31 */   String y2_min = "";
/*      */ 
/*   34 */   String x_axis_colour = "";
/*   35 */   String x_axis_3d = "";
/*   36 */   String x_grid_colour = "";
/*   37 */   int x_axis_steps = 1;
/*   38 */   String y_axis_colour = "";
/*   39 */   String y_grid_colour = "";
/*   40 */   String y2_axis_colour = "";
/*      */ 
/*   43 */   String x_label_style = "";
/*   44 */   String y_label_style = "";
/*   45 */   String y_label_style_right = "";
/*      */ 
/*   48 */   String x_legend = "";
/*   49 */   int x_legend_size = 20;
/*   50 */   String x_legend_colour = "#000000";
/*      */ 
/*   52 */   String y_legend = "";
/*   53 */   String y_legend_right = "";
/*      */ 
/*   57 */   List<Line> lines = new ArrayList();
/*      */ 
/*   62 */   String bg_colour = "";
/*   63 */   String bg_image = "";
/*      */ 
/*   65 */   String inner_bg_colour = "";
/*   66 */   String inner_bg_colour_2 = "";
/*   67 */   String inner_bg_angle = "";
/*      */ 
/*   70 */   String pie = "";
/*   71 */   String pie_values = "";
/*   72 */   String pie_colours = "";
/*   73 */   String pie_labels = "";
/*   74 */   String pie_links = "";
/*      */ 
/*   76 */   String tool_tip = "";
/*      */ 
/*   80 */   List<String> y2_lines = new ArrayList();
/*      */ 
/*   83 */   String y_format = "";
/*   84 */   String num_decimals = "";
/*   85 */   String is_fixed_num_decimals_forced = "";
/*   86 */   String is_decimal_separator_comma = "";
/*   87 */   String is_thousand_separator_disabled = "";
/*      */   String js_path;
/*      */   String swf_path;
/*      */   String output_type;
/*      */   String bg_image_x;
/*      */   String bg_image_y;
/*      */ 
/*      */   public Graph()
/*      */   {
/*   99 */     set_y_min(0);
/*  100 */     set_y_max(20);
/*  101 */     set_x_axis_steps(1);
/*  102 */     y_label_steps(5);
/*      */   }
/*      */ 
/*      */   public void set_js_path(String path)
/*      */   {
/*  140 */     this.js_path = path;
/*      */   }
/*      */ 
/*      */   public void set_swf_path(String path)
/*      */   {
/*  152 */     this.swf_path = path;
/*      */   }
/*      */ 
/*      */   public void set_output_type(String type)
/*      */   {
/*  165 */     this.output_type = type;
/*      */   }
/*      */ 
/*      */   public void increment_occurence()
/*      */   {
/*  170 */     this.occurence += 1;
/*      */   }
/*      */ 
/*      */   public String next_line()
/*      */   {
/*  177 */     String line_num = "";
/*  178 */     if (this.lines.size() > 0) {
/*  179 */       line_num = new StringBuilder().append("_").append(this.lines.size() + 1).toString();
/*      */     }
/*  181 */     return line_num;
/*      */   }
/*      */ 
/*      */   public String esc(String text)
/*      */   {
/*  190 */     String tmp = text.replace(",", "#comma#");
/*      */     try
/*      */     {
/*  193 */       return URLEncoder.encode(tmp, "UTF-8");
/*      */     } catch (UnsupportedEncodingException e) {
/*      */     }
/*  196 */     return text;
/*      */   }
/*      */ 
/*      */   public String format_output(String output_type, String function, int value)
/*      */   {
/*  204 */     return format_output(output_type, function, Integer.toString(value));
/*      */   }
/*      */ 
/*      */   public String format_output(String output_type, String function, String values)
/*      */   {
/*  209 */     String tmp = null;
/*  210 */     if (output_type.equals("js"))
/*  211 */       tmp = new StringBuilder().append("so.addVariable(\"").append(function).append("\",\"").append(values).append("\");").toString();
/*      */     else {
/*  213 */       tmp = new StringBuilder().append("&").append(function).append("=").append(values).append("&").toString();
/*      */     }
/*      */ 
/*  216 */     return tmp;
/*      */   }
/*      */ 
/*      */   public void set_title(String title) {
/*  220 */     set_title(title, "");
/*      */   }
/*      */ 
/*      */   public void set_title(String title, String style)
/*      */   {
/*  232 */     this.title = title;
/*  233 */     if (style.length() > 0)
/*  234 */       this.title_style = style;
/*      */   }
/*      */ 
/*      */   public void set_width(int width)
/*      */   {
/*  244 */     this.width = width;
/*      */   }
/*      */ 
/*      */   public void set_height(int height)
/*      */   {
/*  254 */     this.height = height;
/*      */   }
/*      */ 
/*      */   public void set_base(String base)
/*      */   {
/*  264 */     this.base = base;
/*      */   }
/*      */ 
/*      */   public void set_y_format(String val)
/*      */   {
/*  269 */     this.y_format = val;
/*      */   }
/*      */ 
/*      */   public void set_num_decimals(int val) {
/*  273 */     this.num_decimals = Integer.toString(val);
/*      */   }
/*      */ 
/*      */   public void set_is_fixed_num_decimals_forced(boolean val) {
/*  277 */     this.is_fixed_num_decimals_forced = (val ? "true" : "false");
/*      */   }
/*      */ 
/*      */   public void set_is_decimal_separator_comma(boolean val) {
/*  281 */     this.is_decimal_separator_comma = (val ? "true" : "false");
/*      */   }
/*      */ 
/*      */   public void set_is_thousand_separator_disabled(boolean val) {
/*  285 */     this.is_thousand_separator_disabled = (val ? "true" : "false");
/*      */   }
/*      */ 
/*      */   public void set_data(List<String> a)
/*      */   {
/*  295 */     this.data.add(implode(",", a));
/*      */   }
/*      */ 
/*      */   public void set_links(List<String> a)
/*      */   {
/*  300 */     this.links.add(implode(",", a));
/*      */   }
/*      */ 
/*      */   public void set_x_offset(boolean val)
/*      */   {
/*  305 */     this.x_offset = (val ? "true" : "false");
/*      */   }
/*      */ 
/*      */   public void set_tool_tip(String tip)
/*      */   {
/*  320 */     this.tool_tip = esc(tip);
/*      */   }
/*      */ 
/*      */   public void set_x_labels(List<String> a)
/*      */   {
/*  330 */     this.x_labels = a;
/*      */   }
/*      */ 
/*      */   public void set_x_label_style(String size) {
/*  334 */     set_x_label_style(size, "", 0, -1, "");
/*      */   }
/*      */ 
/*      */   public void set_x_label_style(String size, String colour, int orientation, int step, String grid_colour)
/*      */   {
/*  354 */     this.x_label_style = size;
/*      */ 
/*  356 */     if (colour.length() > 0) {
/*  357 */       this.x_label_style = new StringBuilder().append(this.x_label_style).append(",").append(colour).toString();
/*      */     }
/*  359 */     if (orientation > -1) {
/*  360 */       this.x_label_style = new StringBuilder().append(this.x_label_style).append(",").append(orientation).toString();
/*      */     }
/*  362 */     if (step > 0) {
/*  363 */       this.x_label_style = new StringBuilder().append(this.x_label_style).append(",").append(step).toString();
/*      */     }
/*  365 */     if (grid_colour.length() > 0)
/*  366 */       this.x_label_style = new StringBuilder().append(this.x_label_style).append(",").append(grid_colour).toString();
/*      */   }
/*      */ 
/*      */   public void set_bg_colour(String colour)
/*      */   {
/*  376 */     this.bg_colour = colour;
/*      */   }
/*      */ 
/*      */   public void set_bg_image(String url)
/*      */   {
/*  383 */     set_bg_image(url, "center", "center");
/*      */   }
/*      */ 
/*      */   public void set_bg_image(String url, String x, String y)
/*      */   {
/*  399 */     this.bg_image = url;
/*  400 */     this.bg_image_x = x;
/*  401 */     this.bg_image_y = y;
/*      */   }
/*      */ 
/*      */   public void attach_to_y_right_axis(List<String> data_number)
/*      */   {
/*  412 */     this.y2_lines = data_number;
/*      */   }
/*      */ 
/*      */   public void set_inner_background(String col) {
/*  416 */     set_inner_background(col, "", -1);
/*      */   }
/*      */ 
/*      */   public void set_inner_background(String col, String col2, int angle)
/*      */   {
/*  431 */     this.inner_bg_colour = col;
/*      */ 
/*  433 */     if (col2.length() > 0) {
/*  434 */       this.inner_bg_colour_2 = col2;
/*      */     }
/*  436 */     if (angle != -1)
/*  437 */       this.inner_bg_angle = Integer.toString(angle);
/*      */   }
/*      */ 
/*      */   public String _set_y_label_style(String size, String colour)
/*      */   {
/*  444 */     String tmp = size;
/*      */ 
/*  446 */     if (colour.length() > 0)
/*  447 */       tmp = new StringBuilder().append(tmp).append(",").append(colour).toString();
/*  448 */     return tmp;
/*      */   }
/*      */ 
/*      */   public void set_y_label_style(String size) {
/*  452 */     set_y_label_style(size, "");
/*      */   }
/*      */ 
/*      */   public void set_y_label_style(String size, String colour)
/*      */   {
/*  464 */     this.y_label_style = _set_y_label_style(size, colour);
/*      */   }
/*      */ 
/*      */   public void set_y_right_label_style(String size) {
/*  468 */     set_y_right_label_style(size, "");
/*      */   }
/*      */ 
/*      */   public void set_y_right_label_style(String size, String colour)
/*      */   {
/*  480 */     this.y_label_style_right = _set_y_label_style(size, colour);
/*      */   }
/*      */ 
/*      */   public void set_x_max(int max) {
/*  484 */     this.x_max = Integer.toString(max);
/*      */   }
/*      */ 
/*      */   public void set_x_min(int min) {
/*  488 */     this.x_min = Integer.toString(min);
/*      */   }
/*      */ 
/*      */   public void set_y_max(int max)
/*      */   {
/*  498 */     this.y_max = Integer.toString(max);
/*      */   }
/*      */ 
/*      */   public void set_y_min(int min)
/*      */   {
/*  508 */     this.y_min = Integer.toString(min);
/*      */   }
/*      */ 
/*      */   public void set_y_right_max(int max)
/*      */   {
/*  518 */     this.y2_max = Integer.toString(max);
/*      */   }
/*      */ 
/*      */   public void set_y_right_min(int min)
/*      */   {
/*  528 */     this.y2_min = Integer.toString(min);
/*      */   }
/*      */ 
/*      */   public void y_label_steps(int val)
/*      */   {
/*  538 */     this.y_steps = Integer.toString(val);
/*      */   }
/*      */ 
/*      */   public void title(String title) {
/*  542 */     title(title, "");
/*      */   }
/*      */ 
/*      */   public void title(String title, String style) {
/*  546 */     this.title = esc(title);
/*  547 */     if (style.length() > 0)
/*  548 */       this.title_style = style;
/*      */   }
/*      */ 
/*      */   public void set_x_legend(String text) {
/*  552 */     set_x_legend(text, -1, "");
/*      */   }
/*      */ 
/*      */   public void set_x_legend(String text, int size, String colour)
/*      */   {
/*  566 */     this.x_legend = esc(text);
/*  567 */     if (size > -1) {
/*  568 */       this.x_legend_size = size;
/*      */     }
/*  570 */     if (colour.length() > 0)
/*  571 */       this.x_legend_colour = colour;
/*      */   }
/*      */ 
/*      */   public void set_x_tick_size(int size)
/*      */   {
/*  581 */     if (size > 0)
/*  582 */       this.x_tick_size = size;
/*      */   }
/*      */ 
/*      */   public void set_x_axis_steps(int steps)
/*      */   {
/*  592 */     if (steps > 0)
/*  593 */       this.x_axis_steps = steps;
/*      */   }
/*      */ 
/*      */   public void set_x_axis_3d(int size)
/*      */   {
/*  603 */     if (size > 0)
/*  604 */       this.x_axis_3d = Integer.toString(size);
/*      */   }
/*      */ 
/*      */   public String _set_y_legend(String text, int size, String colour)
/*      */   {
/*  611 */     String tmp = text;
/*      */ 
/*  613 */     if (size > -1) {
/*  614 */       tmp = new StringBuilder().append(tmp).append(",").append(size).toString();
/*      */     }
/*  616 */     if (colour.length() > 0) {
/*  617 */       tmp = new StringBuilder().append(tmp).append(",").append(colour).toString();
/*      */     }
/*  619 */     return tmp;
/*      */   }
/*      */ 
/*      */   public void set_y_legend(String text) {
/*  623 */     set_y_legend(text, -1, "");
/*      */   }
/*      */ 
/*      */   public void set_y_legend(String text, int size, String colour)
/*      */   {
/*  637 */     this.y_legend = _set_y_legend(text, size, colour);
/*      */   }
/*      */ 
/*      */   public void set_y_right_legend(String text) {
/*  641 */     set_y_right_legend(text, -1, "");
/*      */   }
/*      */ 
/*      */   public void set_y_right_legend(String text, int size, String colour)
/*      */   {
/*  655 */     this.y_legend_right = _set_y_legend(text, size, colour);
/*      */   }
/*      */ 
/*      */   public void x_axis_colour(String axis) {
/*  659 */     x_axis_colour(axis, "");
/*      */   }
/*      */ 
/*      */   public void x_axis_colour(String axis, String grid)
/*      */   {
/*  671 */     this.x_axis_colour = axis;
/*  672 */     this.x_grid_colour = grid;
/*      */   }
/*      */ 
/*      */   public void y_axis_colour(String axis) {
/*  676 */     y_axis_colour(axis, "");
/*      */   }
/*      */ 
/*      */   public void y_axis_colour(String axis, String grid)
/*      */   {
/*  688 */     this.y_axis_colour = axis;
/*      */ 
/*  690 */     if (grid.length() > 0)
/*  691 */       this.y_grid_colour = grid;
/*      */   }
/*      */ 
/*      */   public void y_right_axis_colour(String colour)
/*      */   {
/*  702 */     this.y2_axis_colour = colour;
/*      */   }
/*      */ 
/*      */   public void line(int width) {
/*  706 */     line(width, "", "", -1, -1);
/*      */   }
/*      */ 
/*      */   public void line(int width, String colour, String text, int size, int circles)
/*      */   {
/*  725 */     String type = new StringBuilder().append("line").append(next_line()).toString();
/*  726 */     String description = "";
/*      */ 
/*  728 */     if (width > 0) {
/*  729 */       description = new StringBuilder().append(description).append(width).toString();
/*  730 */       description = new StringBuilder().append(description).append(",").append(colour).toString();
/*      */     }
/*      */ 
/*  733 */     if (text.length() > 0) {
/*  734 */       description = new StringBuilder().append(description).append(",").append(text).toString();
/*  735 */       description = new StringBuilder().append(description).append(",").append(size).toString();
/*      */     }
/*      */ 
/*  738 */     if (circles > 0) {
/*  739 */       description = new StringBuilder().append(description).append(",").append(circles).toString();
/*      */     }
/*  741 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void line_dot(String width, String dot_size, String colour) {
/*  745 */     line_dot(width, dot_size, colour, "", "");
/*      */   }
/*      */ 
/*      */   public void line_dot(String width, String dot_size, String colour, String text, String font_size)
/*      */   {
/*  764 */     String type = new StringBuilder().append("line_dot").append(next_line()).toString();
/*      */ 
/*  766 */     String description = new StringBuilder().append(width).append(colour).append(text).toString();
/*      */ 
/*  768 */     if (font_size.length() > 0) {
/*  769 */       description = new StringBuilder().append(description).append(",").append(font_size).append(dot_size).toString();
/*      */     }
/*  771 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void line_hollow(String width, String dot_size, String colour) {
/*  775 */     line_hollow(width, dot_size, colour, "", "");
/*      */   }
/*      */ 
/*      */   public void line_hollow(String width, String dot_size, String colour, String text, String font_size)
/*      */   {
/*  794 */     String type = new StringBuilder().append("line_hollow").append(next_line()).toString();
/*      */ 
/*  796 */     String description = new StringBuilder().append(width).append(",").append(colour).append(",").append(text).toString();
/*      */ 
/*  798 */     if (font_size.length() > 0) {
/*  799 */       description = new StringBuilder().append(description).append(",").append(font_size).append(",").append(dot_size).toString();
/*      */     }
/*  801 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void area_hollow(String width, String dot_size, String colour, String alpha)
/*      */   {
/*  806 */     area_hollow(width, dot_size, colour, alpha, "", "", "");
/*      */   }
/*      */ 
/*      */   public void area_hollow(String width, String dot_size, String colour, String alpha, String text, String font_size, String fill_colour)
/*      */   {
/*  830 */     String type = new StringBuilder().append("area_hollow").append(next_line()).toString();
/*      */ 
/*  832 */     String description = new StringBuilder().append(width).append(",").append(dot_size).append(",").append(colour).append(",").append(alpha).toString();
/*      */ 
/*  835 */     if (text.length() > 0) {
/*  836 */       description = new StringBuilder().append(description).append(",").append(text).append(",").append(font_size).toString();
/*      */     }
/*  838 */     if (fill_colour.length() > 0) {
/*  839 */       description = new StringBuilder().append(description).append(",").append(fill_colour).toString();
/*      */     }
/*  841 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void bar(String alpha) {
/*  845 */     bar(alpha, "", "", -1);
/*      */   }
/*      */ 
/*      */   public void bar(String alpha, String colour, String text, int size)
/*      */   {
/*  862 */     String type = new StringBuilder().append("bar").append(next_line()).toString();
/*      */ 
/*  864 */     String description = new StringBuilder().append(alpha).append(",").append(colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/*  866 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void bar_filled(String alpha, String colour, String colour_outline) {
/*  870 */     bar_filled(alpha, colour, colour_outline, "", -1);
/*      */   }
/*      */ 
/*      */   public void bar_filled(String alpha, String colour, String colour_outline, String text, int size)
/*      */   {
/*  890 */     String type = new StringBuilder().append("filled_bar").append(next_line()).toString();
/*      */ 
/*  892 */     String description = new StringBuilder().append(alpha).append(",").append(colour).append(",").append(colour_outline).append(",").append(text).append(",").append(size).toString();
/*      */ 
/*  895 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void bar_sketch(String alpha, String offset, String colour, String colour_outline)
/*      */   {
/*  900 */     bar_sketch(alpha, offset, colour, colour_outline, "", -1);
/*      */   }
/*      */ 
/*      */   public void bar_sketch(String alpha, String offset, String colour, String colour_outline, String text, int size)
/*      */   {
/*  905 */     String type = new StringBuilder().append("bar_sketch").append(next_line()).toString();
/*      */ 
/*  907 */     String description = new StringBuilder().append(alpha).append(",").append(offset).append(",").append(colour).append(",").append(colour_outline).append(",").append(text).append(",").append(size).toString();
/*      */ 
/*  910 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void bar_3D(String alpha) {
/*  914 */     bar_3D(alpha, "", "", -1);
/*      */   }
/*      */ 
/*      */   public void bar_3D(String alpha, String colour, String text, int size)
/*      */   {
/*  931 */     String type = new StringBuilder().append("bar_3d").append(next_line()).toString();
/*      */ 
/*  933 */     String description = new StringBuilder().append(alpha).append(",").append(colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/*  935 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void bar_glass(String alpha, String colour, String outline_colour) {
/*  939 */     bar_glass(alpha, colour, outline_colour, "", -1);
/*      */   }
/*      */ 
/*      */   public void bar_glass(String alpha, String colour, String outline_colour, String text, int size)
/*      */   {
/*  959 */     String type = new StringBuilder().append("bar_glass").append(next_line()).toString();
/*      */ 
/*  961 */     String description = new StringBuilder().append(alpha).append(",").append(colour).append(",").append(outline_colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/*  964 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void bar_fade(String alpha) {
/*  968 */     bar_fade(alpha, "", "", -1);
/*      */   }
/*      */ 
/*      */   public void bar_fade(String alpha, String colour, String text, int size)
/*      */   {
/*  985 */     String type = new StringBuilder().append("bar_fade").append(next_line()).toString();
/*      */ 
/*  987 */     String description = new StringBuilder().append(alpha).append(",").append(colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/*  989 */     this.lines.add(new Line(type, description));
/*      */   }
/*      */ 
/*      */   public void candle(List<Bar> data, String alpha, String line_width, String colour)
/*      */   {
/*  994 */     candle(data, alpha, line_width, colour, "", -1);
/*      */   }
/*      */ 
/*      */   public void candle(List<Bar> data, String alpha, String line_width, String colour, String text, int size)
/*      */   {
/*  999 */     String type = new StringBuilder().append("candle").append(next_line()).toString();
/*      */ 
/* 1001 */     String description = new StringBuilder().append(alpha).append(",").append(line_width).append(",").append(colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/* 1004 */     this.lines.add(new Line(type, description));
/*      */ 
/* 1006 */     List a = new ArrayList();
/* 1007 */     for (Bar b : data) {
/* 1008 */       a.add(b.toString("", ""));
/*      */     }
/* 1010 */     this.data.add(implode(",", a));
/*      */   }
/*      */ 
/*      */   public void hlc(List<Hlc> data, String alpha, String line_width, String colour)
/*      */   {
/* 1015 */     hlc(data, alpha, line_width, colour, "", -1);
/*      */   }
/*      */ 
/*      */   public void hlc(List<Hlc> data, String alpha, String line_width, String colour, String text, int size)
/*      */   {
/* 1020 */     String type = new StringBuilder().append("hlc").append(next_line()).toString();
/*      */ 
/* 1022 */     String description = new StringBuilder().append(alpha).append(",").append(line_width).append(",").append(colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/* 1025 */     this.lines.add(new Line(type, description));
/*      */ 
/* 1027 */     List a = new ArrayList();
/* 1028 */     for (Hlc anHlc : data) {
/* 1029 */       a.add(anHlc.toString(null, null));
/*      */     }
/* 1031 */     this.data.add(implode(",", a));
/*      */   }
/*      */ 
/*      */   public void scatter(List<Point> data, String line_width, String colour) {
/* 1035 */     scatter(data, line_width, colour, "", -1);
/*      */   }
/*      */ 
/*      */   public void scatter(List<Point> data, String line_width, String colour, String text, int size)
/*      */   {
/* 1040 */     String type = new StringBuilder().append("scatter").append(next_line()).toString();
/*      */ 
/* 1042 */     String description = new StringBuilder().append(line_width).append(",").append(colour).append(",").append(text).append(",").append(size).toString();
/*      */ 
/* 1045 */     this.lines.add(new Line(type, description));
/*      */ 
/* 1047 */     List a = new ArrayList();
/* 1048 */     for (Point p : data) {
/* 1049 */       a.add(p.toString("", ""));
/*      */     }
/* 1051 */     this.data.add(implode(",", a));
/*      */   }
/*      */ 
/*      */   public void pie(int alpha, String line_colour, String label_colour)
/*      */   {
/* 1058 */     pie(alpha, line_colour, label_colour, true, false);
/*      */   }
/*      */ 
/*      */   public void pie(int alpha, String line_colour, String label_colour, boolean gradient, boolean border_size)
/*      */   {
/* 1078 */     this.pie = new StringBuilder().append("").append(alpha).append(",").append(line_colour).append(",").append(label_colour).toString();
/* 1079 */     if (!gradient) {
/* 1080 */       this.pie = new StringBuilder().append(this.pie).append(",").append(!gradient).toString();
/*      */     }
/* 1082 */     if (border_size) {
/* 1083 */       if (!gradient) {
/* 1084 */         this.pie = new StringBuilder().append(this.pie).append(",").toString();
/*      */       }
/* 1086 */       this.pie = new StringBuilder().append(this.pie).append(",").append(border_size).toString();
/*      */     }
/*      */   }
/*      */ 
/*      */   public void pie_values(List<String> values) {
/* 1091 */     pie_values(values, null, null);
/*      */   }
/*      */ 
/*      */   public void pie_values(List<String> values, List<String> labels, List<String> links)
/*      */   {
/* 1106 */     this.pie_values = implode(",", values);
/* 1107 */     this.pie_labels = implode(",", labels);
/* 1108 */     this.pie_links = implode(",", links);
/*      */   }
/*      */ 
/*      */   public void pie_slice_colours(List<String> colours)
/*      */   {
/* 1118 */     this.pie_colours = implode(",", colours);
/*      */   }
/*      */ 
/*      */   public String render()
/*      */   {
/* 1125 */     return render("");
/*      */   }
/*      */ 
/*      */   public String render(String output_type) {
/* 1129 */     List tmp = new ArrayList();
/*      */ 
/* 1131 */     if (output_type.equals("js")) {
/* 1132 */       increment_occurence();
/*      */ 
/* 1134 */       tmp.add(new StringBuilder().append("<div id=\"my_chart").append(this.occurence).append("\"></div>").toString());
/* 1135 */       tmp.add(new StringBuilder().append("<script type=\"text/javascript\" src=\"").append(this.base).append("swfobject.js\"></script>").toString());
/*      */ 
/* 1137 */       tmp.add("<script type=\"text/javascript\">");
/* 1138 */       tmp.add(new StringBuilder().append("var so = new SWFObject(\"open-flash-chart.swf\", \"ofc\", \"").append(this.width).append("\", \"").append(this.height).append("\", \"9\", \"#FFFFFF\");").toString());
/*      */ 
/* 1144 */       tmp.add("so.addVariable(\"variables\",\"true\");");
/*      */     }
/*      */ 
/* 1147 */     if (this.title.length() > 0) {
/* 1148 */       StringBuffer values = new StringBuffer(this.title);
/* 1149 */       values.append(',').append(this.title_style);
/* 1150 */       tmp.add(format_output(output_type, "title", values.toString()));
/*      */     }
/*      */ 
/* 1155 */     if (this.x_legend.length() > 0) {
/* 1156 */       StringBuffer values = new StringBuffer(this.x_legend);
/* 1157 */       values.append(',').append(this.x_legend_size);
/* 1158 */       values.append(',').append(this.x_legend_colour);
/* 1159 */       tmp.add(format_output(output_type, "x_legend", values.toString()));
/*      */     }
/*      */ 
/* 1163 */     if (this.x_label_style.length() > 0) {
/* 1164 */       tmp.add(format_output(output_type, "x_label_style", this.x_label_style));
/*      */     }
/*      */ 
/* 1167 */     if (this.x_tick_size > 0) {
/* 1168 */       tmp.add(format_output(output_type, "x_ticks", this.x_tick_size));
/*      */     }
/*      */ 
/* 1171 */     if (this.x_axis_steps > 0) {
/* 1172 */       tmp.add(format_output(output_type, "x_axis_steps", this.x_axis_steps));
/*      */     }
/*      */ 
/* 1175 */     if (this.x_axis_3d.length() > 0) {
/* 1176 */       tmp.add(format_output(output_type, "x_axis_3d", this.x_axis_3d));
/*      */     }
/*      */ 
/* 1179 */     if (this.y_legend.length() > 0) {
/* 1180 */       tmp.add(format_output(output_type, "y_legend", this.y_legend));
/*      */     }
/* 1182 */     if (this.y_legend_right.length() > 0) {
/* 1183 */       tmp.add(format_output(output_type, "y2_legend", this.y_legend_right));
/*      */     }
/*      */ 
/* 1186 */     if (this.y_label_style.length() > 0) {
/* 1187 */       tmp.add(format_output(output_type, "y_label_style", this.y_label_style));
/*      */     }
/*      */ 
/* 1190 */     tmp.add(format_output(output_type, "y_ticks", new StringBuilder().append("5,10,").append(this.y_steps).toString()));
/*      */ 
/* 1193 */     if (this.lines.size() == 0) {
/* 1194 */       tmp.add(format_output(output_type, "line", "3,#87421F"));
/*      */     }
/*      */     else
/*      */     {
/* 1203 */       for (Line line : this.lines) {
/* 1204 */         tmp.add(format_output(output_type, line.type, line.description));
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/* 1209 */     int num = 1;
/* 1210 */     for (String data : this.data) {
/* 1211 */       if (num == 1)
/* 1212 */         tmp.add(format_output(output_type, "values", data));
/*      */       else {
/* 1214 */         tmp.add(format_output(output_type, new StringBuilder().append("values_").append(num).toString(), data));
/*      */       }
/*      */ 
/* 1217 */       num++;
/*      */     }
/*      */ 
/* 1220 */     num = 1;
/* 1221 */     for (String link : this.links) {
/* 1222 */       if (num == 1)
/* 1223 */         tmp.add(format_output(output_type, "links", link));
/*      */       else {
/* 1225 */         tmp.add(format_output(output_type, new StringBuilder().append("links_").append(num).toString(), link));
/*      */       }
/*      */ 
/* 1228 */       num++;
/*      */     }
/*      */ 
/* 1231 */     if (this.y2_lines.size() > 0) {
/* 1232 */       tmp.add(format_output(output_type, "y2_lines", implode(",", this.y2_lines)));
/*      */ 
/* 1237 */       tmp.add(format_output(output_type, "show_y2", "true"));
/*      */     }
/*      */ 
/* 1240 */     if (this.x_labels.size() > 0) {
/* 1241 */       tmp.add(format_output(output_type, "x_labels", implode(",", this.x_labels)));
/*      */     }
/*      */     else {
/* 1244 */       if (this.x_min.length() > 0) {
/* 1245 */         tmp.add(format_output(output_type, "x_min", this.x_min));
/*      */       }
/* 1247 */       if (this.x_max.length() > 0) {
/* 1248 */         tmp.add(format_output(output_type, "x_max", this.x_max));
/*      */       }
/*      */     }
/* 1251 */     tmp.add(format_output(output_type, "y_min", this.y_min));
/* 1252 */     tmp.add(format_output(output_type, "y_max", this.y_max));
/*      */ 
/* 1254 */     if (this.y2_min.length() > 0) {
/* 1255 */       tmp.add(format_output(output_type, "y2_min", this.y2_min));
/*      */     }
/* 1257 */     if (this.y2_max.length() > 0) {
/* 1258 */       tmp.add(format_output(output_type, "y2_max", this.y2_max));
/*      */     }
/* 1260 */     if (this.bg_colour.length() > 0) {
/* 1261 */       tmp.add(format_output(output_type, "bg_colour", this.bg_colour));
/*      */     }
/*      */ 
/* 1264 */     if (this.bg_image.length() > 0) {
/* 1265 */       tmp.add(format_output(output_type, "bg_image", this.bg_image));
/* 1266 */       tmp.add(format_output(output_type, "bg_image_x", this.bg_image_x));
/*      */ 
/* 1268 */       tmp.add(format_output(output_type, "bg_image_y", this.bg_image_y));
/*      */     }
/*      */ 
/* 1272 */     if (this.x_axis_colour.length() > 0) {
/* 1273 */       tmp.add(format_output(output_type, "x_axis_colour", this.x_axis_colour));
/*      */ 
/* 1275 */       tmp.add(format_output(output_type, "x_grid_colour", this.x_grid_colour));
/*      */     }
/*      */ 
/* 1279 */     if (this.y_axis_colour.length() > 0) {
/* 1280 */       tmp.add(format_output(output_type, "y_axis_colour", this.y_axis_colour));
/*      */     }
/*      */ 
/* 1283 */     if (this.y_grid_colour.length() > 0) {
/* 1284 */       tmp.add(format_output(output_type, "y_grid_colour", this.y_grid_colour));
/*      */     }
/*      */ 
/* 1287 */     if (this.y2_axis_colour.length() > 0) {
/* 1288 */       tmp.add(format_output(output_type, "y2_axis_colour", this.y2_axis_colour));
/*      */     }
/*      */ 
/* 1291 */     if (this.x_offset.length() > 0) {
/* 1292 */       tmp.add(format_output(output_type, "x_offset", this.x_offset));
/*      */     }
/* 1294 */     if (this.inner_bg_colour.length() > 0) {
/* 1295 */       StringBuilder values = new StringBuilder(this.inner_bg_colour);
/* 1296 */       if (this.inner_bg_colour_2.length() > 0) {
/* 1297 */         values.append(',').append(this.inner_bg_colour_2);
/* 1298 */         values.append(',').append(this.inner_bg_angle);
/*      */       }
/* 1300 */       tmp.add(format_output(output_type, "inner_background", values.toString()));
/*      */     }
/*      */ 
/* 1304 */     if (this.pie.length() > 0) {
/* 1305 */       tmp.add(format_output(output_type, "pie", this.pie));
/* 1306 */       tmp.add(format_output(output_type, "values", this.pie_values));
/* 1307 */       tmp.add(format_output(output_type, "pie_labels", this.pie_labels));
/*      */ 
/* 1309 */       tmp.add(format_output(output_type, "colours", this.pie_colours));
/*      */ 
/* 1311 */       tmp.add(format_output(output_type, "links", this.pie_links));
/*      */     }
/*      */ 
/* 1314 */     if (this.tool_tip.length() > 0) {
/* 1315 */       tmp.add(format_output(output_type, "tool_tip", this.tool_tip));
/*      */     }
/* 1317 */     if (this.y_format.length() > 0) {
/* 1318 */       tmp.add(format_output(output_type, "y_format", this.y_format));
/*      */     }
/* 1320 */     if (this.num_decimals.length() > 0) {
/* 1321 */       tmp.add(format_output(output_type, "num_decimals", this.num_decimals));
/*      */     }
/*      */ 
/* 1324 */     if (this.is_fixed_num_decimals_forced.length() > 0) {
/* 1325 */       tmp.add(format_output(output_type, "is_fixed_num_decimals_forced", this.is_fixed_num_decimals_forced));
/*      */     }
/*      */ 
/* 1329 */     if (this.is_decimal_separator_comma.length() > 0) {
/* 1330 */       tmp.add(format_output(output_type, "is_decimal_separator_comma", this.is_decimal_separator_comma));
/*      */     }
/*      */ 
/* 1334 */     if (this.is_thousand_separator_disabled.length() > 0) {
/* 1335 */       tmp.add(format_output(output_type, "is_thousand_separator_disabled", this.is_thousand_separator_disabled));
/*      */     }
/*      */ 
/* 1339 */     if (output_type.equals("js")) {
/* 1340 */       tmp.add(new StringBuilder().append("so.write(\"my_chart").append(this.occurence).append("\");").toString());
/* 1341 */       tmp.add("</script>");
/*      */     }
/*      */ 
/* 1344 */     int count = 1;
/* 1345 */     for (Data_set set : this.data_sets) {
/* 1346 */       tmp.add(set.toString(output_type, count > 1 ? new StringBuilder().append("_").append(count).toString() : ""));
/*      */ 
/* 1349 */       count++;
/*      */     }
/*      */ 
/* 1352 */     return implode("\r\n", tmp);
/*      */   }
/*      */ 
/*      */   String implode(String glue, List<String> array) {
/* 1356 */     StringBuilder sb = new StringBuilder();
/* 1357 */     for (String element : array) {
/* 1358 */       if (sb.length() > 0)
/* 1359 */         sb.append(glue);
/* 1360 */       sb.append(element);
/*      */     }
/* 1362 */     return sb.toString();
/*      */   }
/*      */ 
/*      */   public List<Data_set> getData_sets() {
/* 1366 */     return this.data_sets;
/*      */   }
/*      */ 
/*      */   public void setData_sets(List<Data_set> data_sets) {
/* 1370 */     this.data_sets = data_sets;
/*      */   }
/*      */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.openFlashChart.Graph
 * JD-Core Version:    0.6.0
 */